import Vue from 'vue'
import App from './App.vue'
import router from './router'
import ElementUI from 'element-ui';
//导入tree grid插件
import TreeTable from 'vue-table-with-tree-grid'
//导入element ui的样式资源
import 'element-ui/lib/theme-chalk/index.css';
//import './plugins/element.js'
import './assets/fonts/iconfont.css'
import './assets/css/global.css'
//http 
import axios from 'axios'
axios.defaults.baseURL = 'http://127.0.0.1:8888/api/private/v1/'
    //axios.defaults.baseURL = 'http://localhost:8886/travel/'

//通过axios请求拦截器添加token，保证拥有获取数据的权限
axios.interceptors.request.use(config => {
    //为请求头添加Token验证的`Authorization` 字段
    config.headers.Authorization = window.sessionStorage.getItem('token')
        //一定要return出config
    return config
})
Vue.prototype.$http = axios

Vue.use(ElementUI);
Vue.component('tree-table', TreeTable)
Vue.config.productionTip = false

new Vue({
    router,
    render: h => h(App)
}).$mount('#app')